package org.blog.util.encode;

import java.util.Random;

public class PwdEncode {

	/**
	 * 对密码进行加密
	 * 
	 * @param password
	 * @param randKey
	 * @return
	 */
	public static String getEncryptPassword(String password, String randKey) {
		return CreateKey.getEncryptPwd(password, randKey, "personblog");
	}

	/**
	 * 对密码进行解密
	 * 
	 * @param encryptPassword
	 * @param randKey
	 * @return
	 */
	public static String getUnEncryptPassword(String encryptPassword,
			String randKey) {
		return CreateKey
				.getUnEncryptPwd(encryptPassword, randKey, "personblog");
	}

	/**
	 * 生成随机码
	 * 
	 * @return
	 */
	public static String getRandKey() {
		Random tRand = new Random();
		tRand.setSeed(System.currentTimeMillis());
		return CreateKey.getMD5ofStr(String.valueOf(tRand.nextLong()));
	}
}
